package edu.cueb.wmis.mapper;

import edu.cueb.wmis.pojo.Outbill;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liuzizhuo
 * @since 2021-04-19
 */
public interface OutbillMapper extends BaseMapper<Outbill> {
    @Select("SELECT COUNT(*) FROM tb_outbill WHERE billName LIKE CONCAT('%',#{year},'%')")
    Integer findMaxBillName(@Param("year") String year);
    @Select("SELECT ob.`id` FROM tb_outbill ob LEFT JOIN tb_orderbill orb ON orb.`id` = ob.`orderId` LEFT JOIN tb_orderbillitem orbi ON orbi.`billId` = orb.`id` WHERE orbi.id = #{orbiId};")
    Integer getOubbillIdbyOrderItemId(Integer orbiId);
    @Select("SELECT id FROM tb_outbill")
    List<Integer> selectAllInbillId();
}
